package etnorservice.etnor_service.mapper;


import etnorservice.etnor_service.domain.po.AccessLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AccessLogMapper {
    @Insert("INSERT INTO access_logs (ip_address, directory_path, access_time, is_blocked) VALUES (#{ipAddress}, #{directoryPath}, NOW(), FALSE)")
    void insertAccessLog(AccessLog accessLog);

    @Select("SELECT COUNT(*) FROM access_logs WHERE ip_address = #{ipAddress} AND is_blocked = FALSE")
    long countByIpAddressAndIsBlockedFalse(String ipAddress);
}